#include<bits/stdc++.h>

using namespace std;


int main() {
    vector<int> a;
    int q;
    cin >> q;
    while (q--) {
        int op, x;
        cin >> op;
        if (op == 0) {
            cin >> x;
            a.emplace_back(x);
        } else if (op == 2) {
            if (a.size())a.pop_back();
        } else if (op == 1) {
            cin >> x;
            if (x < 0 || x >= a.size())continue;
            cout << a[x] << endl;
        }

    }

    return 0;
}